package com.hmall.trade.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hmall.trade.domain.po.OrderDetail;
import com.hmall.trade.mapper.OrderDetailMapper;
import com.hmall.trade.service.IOrderDetailService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 订单详情表 服务实现类
 * </p>
 *
 * @author 虎哥
 * @since 2023-05-05
 */
@Service
public class OrderDetailServiceImpl extends ServiceImpl<OrderDetailMapper, OrderDetail> implements IOrderDetailService {

    /**
     * 查询订单详情
     * @param orderId
     * @return
     */
    @Override
    public List<OrderDetail> listByOrderId(Long orderId) {
        //  根据订单id查询订单详情
        return baseMapper.selectList(
                Wrappers.<OrderDetail>lambdaQuery()
                        .eq(OrderDetail::getOrderId, orderId));
    }
}
